# -*- coding:utf-8 -*-
'''
@Author: lindes
'''
import xadmin

from .models import GoodCategory, GoodArticle, CollectGoodArticle, PraiseGoodArticle, InformGoodArticle, \
    CommentGoodArticle


class GoodCategoryAdmin:
    list_display = ['name', 'ordered', 'add_time']
    list_filter = ['name', 'ordered', 'add_time']
    search_fields = ['name', 'ordered', 'add_time']


class GoodArticleAdmin:
    list_display = ['title', 'author', 'category', 'content', 'click_count', 'praise_count', 'comment_count',
                    'collect_count', 'inform_count']
    list_filter = ['title', 'author', 'category', 'content', 'click_count', 'praise_count', 'comment_count',
                   'collect_count', 'inform_count']
    search_fields = ['title', 'content']
    style_fields = {"content": "ueditor"}


class CollectGoodArticleAdmin:
    list_display = ['user', 'good_article', 'add_time']
    list_filter = ['add_time']
    search_fields = ['user']


class PraiseGoodArticleAdmin:
    list_display = ['user', 'good_article', 'add_time']
    list_filter = ['add_time']
    search_fields = ['user']


class InformGoodArticleAdmin:
    list_display = ['user', 'good_article', 'add_time']
    list_filter = ['add_time']
    search_fields = ['user']


class CommentGoodArticleAdmin:
    list_display = ['user', 'good_article', 'pid', 'content', 'add_time']
    list_filter = ['content', 'add_time']
    search_fields = ['user', 'content']


xadmin.site.register(GoodCategory, GoodCategoryAdmin)
xadmin.site.register(GoodArticle, GoodArticleAdmin)
xadmin.site.register(CollectGoodArticle, CollectGoodArticleAdmin)
xadmin.site.register(PraiseGoodArticle, PraiseGoodArticleAdmin)
xadmin.site.register(InformGoodArticle, InformGoodArticleAdmin)
xadmin.site.register(CommentGoodArticle, CommentGoodArticleAdmin)
